import { createApp } from 'vue'
import { createPinia } from 'pinia' // 导入 createPinia
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
const app = createApp(App)
const pinia = createPinia() // 创建 Pinia 实例

// 先注册 Pinia
app.use(pinia)

// 然后初始化用户状态
import { useUserStore } from './store/modules/user'
const userStore = useUserStore()

userStore.initialize().finally(() => {
    // 最后注册路由并挂载应用
    app.use(router)
    app.use(ElementPlus);
    app.mount('#app')
})
